import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    name: 'index',
    component: ()=> import('../views/Index.vue'),
    children:[
      {
        path:'/index/home',
        name:'home',
        component:() => import('../views/Index/Home.vue')
      },
      {
        path:'/index/tuan',
        name:'tuan',
        component:() => import('../views/Index/Tuan.vue')
      },
      {
        path:'/index/order',
        name:'order',
        component:()=> import('../views/Index/Order.vue')
      },
      {
        path:'/index/mine',
        name:'mine',
        component:()=> import('../views/Index/Mine.vue')
      },
      {
        path:'/index',
        redirect:'/index/home'
      },
      {
        path:'*',
        component:() => import('../views/NotFound.vue')
      }
    ]
  },
  {
    path:'/detail/:id',
    name:'detail',
    component:()=>import('../views/Detail.vue')
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('../views/Login.vue')
  },
  {
    path:'/register',
    name:'register',
    component:()=>import('../views/Register.vue')
  },
  {
    path:'/collect',
    name:'collect',
    component:()=>import('../views/Collect.vue')
  },
  {
    path:'/address',
    name:'address',
    component:()=>import('../views/Address.vue')
  },
  {
    path:'/',
    redirect:'/login'
  },
  {
    path:'*',
    component:()=>import('../views/NotFound.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
